package com.study.controller;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.study.biz.htloginbiz;

/**
 * Servlet implementation class htloginservlet
 */
@WebServlet("/htlogin")
public class htloginservlet extends BaseServlet{
	private static final long serialVersionUID = 1L;

	@Override
	public String excute(HttpServletRequest request, HttpServletResponse response) throws Exception {
		// TODO Auto-generated method stub
		return "f:admin/htlogin";
	}
    public String login(HttpServletRequest request, HttpServletResponse response){
    	String name=request.getParameter("zh");
    	String pwd=request.getParameter("pwd");
    	htloginbiz hbiz=new htloginbiz();
    	
    	boolean p1=hbiz.pdZh(name);
    	if(!p1){
    		request.setAttribute("login", 1);
    		return "f:admin/htlogin";
    	}
    	boolean p2=hbiz.pdPwd(name, pwd);
    	if(!p2){
    		request.setAttribute("login", -1);
    		return "f:admin/htlogin";
    	}
    	return "r:htmain";
    }
}
